<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>盘点记录管理</title>
<meta name="decorator" content="default"/>
<script src="${ctxStatic}/common/change/change.js"></script>
<style type="text/css">		
	#contentTable td ,#contentTable th{
		text-align: center !important;
	}	
	caption{
    	font-size:18px;
    	color:#555555;
    }
	.minWidth {
		min-width: 177px;
	}
</style>
<script type="text/javascript">
$(document).ready(function() {
	initVaccName(bsVaccineBatchno.companyCode,bsVaccineBatchno.vaccineId);
	/* $(".vaccineCompany").change(function(){
		initCompanyName($(this).val());
	}); */
	
    var action_old = $("#searchForm").attr("action");
	$("#btnExport").click(function(){
		top.$.jBox.confirm("确认要导出盘点记录吗？","系统提示",function(v,h,f){
			if(v=="ok"){
				$("#searchForm").attr("action","${ctx}/vaccinate/product/bsCheckRecord/export");
				$("#searchForm").submit();
				$("#searchForm").attr("action",action_old);
			}
		},{buttonsFocus:1});
		top.$('.jbox-body .jbox-icon').css('top','55px');
	});
	
	$("#btnReset").click(function(){
		$("#vaccineId").val("").select2();
		$("#status").val("");
		$("#name").val("");
		$("#code").val("");
		$("#beginDate").val("");
		$("#endDate").val("");
	});
});
var bsVaccineBatchno = JSON.parse('${fns:toJson(bsCheckRecord.bsVaccineBatchno)}');
var bsCheckRecord = JSON.parse('${fns:toJson(bsCheckRecord)}');
function page(n,s){
	$("#pageNo").val(n);
	$("#pageSize").val(s);
	$("#searchForm").submit();
    return false;
}
</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="#">库存盘点记录</a></li>
		<shiro:hasPermission name="vaccinate:product:bsCheckRecord:edit"><li><a href="${ctx}/vaccinate/product/bsCheckRecord/form">盘点记录添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="bsCheckRecord" action="${ctx}/vaccinate/product/bsCheckRecord/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<div class="breadcrumb">
			<table class="table table-bordered">
				<tr>
					<th>名称:</th>
					<td>
						<form:select path="bsVaccineBatchno.vaccineId" id="vaccineId" class="span2 minWidth vaccineCompany" >
						</form:select>
					</td>
					<th>操作人：</th>
					<td>
						<form:input path="user.name" id="name" class="span2 minWidth"/>
					</td>
					<th>盘点编号：</th>
					<td>
						<form:input path="code" id="code" class="span2 minWidth"/>
					</td>
				</tr>
				<tr>
				    <th>盘点起始时间:</th>
					<td>
						<input name="beginDate" id="beginDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
							value="<fmt:formatDate value="${bsCheckRecord.beginDate}" pattern="yyyy-MM-dd"/>"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
					</td>
					<th>盘点结束时间:</th>
					<td colspan = "3">
						<input name="endDate" id="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
							value="<fmt:formatDate value="${bsCheckRecord.endDate}" pattern="yyyy-MM-dd"/>"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
					</td>
				</tr>
			</table>
		</div>
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
	    <!-- <a href="#" class="btn btn-primary">打印</a> -->
		<input id="btnExport" class="btn btn-primary" type="button" value="导出"/>
		<input id="btnReset" class="btn btn-primary" type="button" value="重置"/>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
	    <!-- <caption>库存盘点记录</caption> -->
		<thead>
			<tr>
			    <th>编号</th>
			    <th>盘点编号</th>
				<th>名称</th>
				<th>生产厂商</th>
				<th>批次编号</th>
				<th>盘点前库存</th>
				<th>盘点后库存</th>
				<th>盘点数量</th>
				<th>操作人</th>
				<!-- <th>创建时间</th> -->
				<th>备注</th>
				<th>操作时间</th>
				<shiro:hasPermission name="vaccinate:product:bsCheckRecord:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="bsCheckRecord" begin="0" varStatus="status">
			<tr>
			    <td>
					${(page.pageNo-1)*page.pageSize+status.index+1 }
				</td>
				<td>
					<a href="${ctx}/vaccinate/product/bsCheckRecord?code=${bsCheckRecord.code}">
						 ${bsCheckRecord.code}
					</a>
				   
				</td>
				<td>
					${bsCheckRecord.bsVaccineBatchno.vaccineName}
				</td>
				<td>
				    ${bsCheckRecord.bsVaccineBatchno.companyName}
				</td>
				<td>
				    ${bsCheckRecord.bsVaccineBatchno.batchno}
					<c:if test="${not empty bsCheckRecord.bsVaccineBatchno.secondBatchno}">
				        <span title="(查询批号时不需要带入亚批号)" style="color:#2fa4e7;">-${bsCheckRecord.bsVaccineBatchno.secondBatchno}</span>
				    </c:if> 
				</td>
				<td>
					${bsCheckRecord.checkBefore}
				</td>
				<td>
					${bsCheckRecord.checkAfter}
				</td>
				<td>
					${bsCheckRecord.checkNum}
				</td>
				<td>
					${bsCheckRecord.user.name}
				</td>
				<%-- <td>
					<fmt:formatDate value="${bsCheckRecord.product.createDate}" pattern="yyyy-MM-dd"/>
				</td> --%>
				<td>
					${bsCheckRecord.remarks}
				</td>
				<td>
					<fmt:formatDate value="${bsCheckRecord.updateDate}" pattern="yyyy-MM-dd"/>
				</td>
				<shiro:hasPermission name="vaccinate:product:bsCheckRecord:edit"><td>
    				<a href="${ctx}/vaccinate/product/bsCheckRecord/form?id=${bsCheckRecord.id}">修改</a>
					<a href="${ctx}/vaccinate/product/bsCheckRecord/delete?id=${bsCheckRecord.id}" onclick="return confirmx('确认要删除该盘点记录吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>